home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-09-22 | 45.2 KB | 1,831 lines |
- diff -cr ../mntlib35/Changelog ./Changelog
- *** ../mntlib35/Changelog Mon Sep 13 07:21:28 1993
- --- ./Changelog Wed Sep 22 15:06:46 1993
- ***************
- *** 4,9 ****
- --- 4,90 ----
- Changes are listed in *reverse* order, most recent changes being
- first.
-
- + PATCHLEVEL36::
- +
- + mincl:
- + Added target for nlist.o.
- + mincl, sozobon/makefile, lattice/mincl.lcc, purec/mintlib.prj: ++entropy
- + Added targets for truncate.o, wcmb.o, printf.o, vfprintf.o,
- + vprintf.o.
- + truncate.c, types.h: ++schwab
- + NEW file, implementation of truncate()/ftruncate(). Protos in
- + types.h.
- + getwd.c: ++schwab
- + Make getwd() return an error message in the buffer on failure.
- + _addsubs.cpp: ++nox
- + Correct an inverted branch.
- + open.c: ++nox@jelal.north.de, ++entropy
- + Fix so that when we use Fcreate() we then Fclose() and Fopen() the
- + file, so we get sharing modes correct.
- + utime.c: ++schwab
- + utime(NULL) uses time() to convert the current time to Unix format
- + and immediately converts it back to GEMDOS format. Instead it should
- + use the GEMDOS format directly.
- + stime() must be changed because Tset{date,time} can now return a
- + real error number. This depends on Tset{date,time} returning -1 if
- + args are bad, which is true for all TOS versions, i think.
- + ttyname.c: ++schwab
- + ttyname() should not return names starting with "u:" when _rootdir is
- + 'U', to be consistent with rest of library. find_ino now gets the
- + dir name in gemdos format and it calls dos2unx on it. ttyname.c
- + unnecessarily depends on dirent.c, we know that Dreaddir works. We
- + can also avoid the hairy fstat(), since we know that Fcntl(FSTAT)
- + works.
- + signal.c: ++schwab
- + Pass through additional signal handler parameters via _trampoline().
- + rename.c: ++rwilhelm@physik.tu-muenchen.de
- + Eliminate a useless strcmp().
- + main.c: ++schwab
- + When converting a path variable from the environment, we can conserve
- + memory by using the fact that _path_unx2dos enlarges the path by at
- + most two times the number of elements. On the other hand, if there is
- + no PCONVERT env var, the provided space was too small.
- + isatty.c: ++schwab
- + Removes the dependency of isatty() on ttyname().
- + spawn.c: ++schwab
- + Cleaned up the script emulation code, and changed it in that only
- + files starting with "#!" are interpretable (as Unix does). The
- + first 1024 bytes of the file are examined when looking for
- + interpreter and arguments. A small bug is also corrected: errno
- + should never be changed when there is no error.
- + falcon.h: ++Markus_Kilbinger@ac.maus.de
- + Add two omitted backslashes to fix new trap definitions.
- + chmod.c: ++schwab@ls5.informatik.uni-dortmund.de
- + chmod() unnecessarily calls stat() to check if the file is a
- + directory; this information is already available through Fattrib().
- + nlist.c, nlist.h: ++shenson@nyx.cs.du.edu
- + NEW files nlist.c, nlist.h. A version of nlist() for mntlib/toslib.
- + Works OK with my binary config program but your milage may vary.
- + wcmb.c, stdlib.h: ++pvt1-117@nada.kth.se
- + NEW file wcmb.c for ANSI wide char functions.
- + waitpid.c: ++Robert.Wilhelm@Physik.TU-Muenchen.DE
- + Add a forgotten patch for non-GCC compilers.
- + ctype.h: ++dsb@cs.duke.edu
- + The toint() macro in ctype.h was translating hex digits wrong.
- + --begin jrb changes--
- + math-68881.h: ++jrb
- + -- Put extern "C" around file when __cplusplus
- + -- Make hypot use internal version of sqrt (because signature
- + clash in libg++:xfix )
- + -- Define internal version (_sqrt) of sqrt.
- + osbind.h: ++Robert.Wilhelm@Physik.TU-Muenchen.DE
- + Changed addw #n,sp to lea n(s),sp which is 4 cycles shorter.
- + fprintf.c: ++jrb
- + Break out vfprintf, printf and vprintf into their own .o's. That
- + way the user can replace any of them.
- + printf.c, vfprintf.c, vprintf.c:: ++jrb
- + NEW files.
- + mincl: ++jrb
- + Add targets for above.
- + gnulib2.c: Steven Ourada (sourada@iastate.edu)
- + #define WORD_BIG_ENDIAN for long long.
- + --end jrb changes--
- +
- PATCHLEVEL35::
-
- unx2dos.c: ++schwab
- ***************
- *** 84,90 ****
- Add errors ENOTDIR and ELOOP.
- signal.h: ++Ole_Arndt@f.maus.de (Ole Arndt)
- Fix definition of _SIGSET_MAX_INDEX to correct several bugs
- ! in the POSIX signal mask functios.
- stdio.h:
- Add vsscanf() and _getbuf() protos (yech).
- dirent.h:
- --- 165,171 ----
- Add errors ENOTDIR and ELOOP.
- signal.h: ++Ole_Arndt@f.maus.de (Ole Arndt)
- Fix definition of _SIGSET_MAX_INDEX to correct several bugs
- ! in the POSIX signal mask functions.
- stdio.h:
- Add vsscanf() and _getbuf() protos (yech).
- dirent.h:
- diff -cr ../mntlib35/Files ./Files
- *** ../mntlib35/Files Sun Jul 18 09:03:42 1993
- --- ./Files Tue Sep 21 20:34:36 1993
- ***************
- *** 8,18 ****
- _cmpdf2.cpp bcopy.cpp fsetpos.c memcmp.c strftime.c
- _cmpsf2.cpp binmode.c ftw.c mktemp.c stricmp.c
- _divdf3.cpp bsearch.c fungetc.c modf.cpp strlen.c
- ! _divmods.s bzero.cpp fwrite.c strlwr.c
- _divsf3.cpp calloc.c gbl-ctors.h strncat.c
- _extends.cpp chdir.c getbuf.c obstack.c strncmp.c
- _fixdfsi.cpp chmod.c getenv.c perror.c strncpy.c
- ctermid.c getlogin.c pgrp.c
- _fixsfsi.cpp ctime.c getopt.c psignal.c strnicmp.c
- _fltsi.cpp ctype.c getpass.c putenv.c strpbrk.c
- _fltsisf.cpp cuserid.c getpid.c qsort.c strrchr.c
- --- 8,19 ----
- _cmpdf2.cpp bcopy.cpp fsetpos.c memcmp.c strftime.c
- _cmpsf2.cpp binmode.c ftw.c mktemp.c stricmp.c
- _divdf3.cpp bsearch.c fungetc.c modf.cpp strlen.c
- ! _divmods.s bzero.cpp fwrite.c nlist.c strlwr.c
- _divsf3.cpp calloc.c gbl-ctors.h strncat.c
- _extends.cpp chdir.c getbuf.c obstack.c strncmp.c
- _fixdfsi.cpp chmod.c getenv.c perror.c strncpy.c
- ctermid.c getlogin.c pgrp.c
- + printf.c
- _fixsfsi.cpp ctime.c getopt.c psignal.c strnicmp.c
- _fltsi.cpp ctype.c getpass.c putenv.c strpbrk.c
- _fltsisf.cpp cuserid.c getpid.c qsort.c strrchr.c
- ***************
- *** 34,42 ****
- abs.c findfile.c ldexp.cpp sprintf.c toxxx.c
- access.c flonum.h lib.h stksiz.c utime.c
- alglobal.c fopen.c libgcc1.c strcat.c
- ! libgcc2.c
- ! alloca.cpp fprintf.c linea.c strchr.c
- ! alphasor.c fputc.c localtim.c strcmp.c
- longlong.h
-
- MiNT library:
- --- 35,43 ----
- abs.c findfile.c ldexp.cpp sprintf.c toxxx.c
- access.c flonum.h lib.h stksiz.c utime.c
- alglobal.c fopen.c libgcc1.c strcat.c
- ! libgcc2.c vfprintf.c
- ! alloca.cpp fprintf.c linea.c strchr.c vprintf.c
- ! alphasor.c fputc.c localtim.c strcmp.c wcmb.c
- longlong.h
-
- MiNT library:
- ***************
- *** 51,56 ****
- --- 52,58 ----
- Makefile getcwd.c read.c sysconf.c
- OChangelog rename.c thread.c
- PatchLev.h getdtabl.c link.c rmdir.c times.c
- + truncate.c
- README getgroup.c lockf.c scandir.c ttyname.c
- alarm.c gethostn.c main.c scanf.c uname.c
- atexit.c getpages.c select.c unlink.c
- diff -cr ../mntlib35/Makefile ./Makefile
- *** ../mntlib35/Makefile Mon Sep 13 11:22:00 1993
- --- ./Makefile Wed Sep 15 09:55:56 1993
- ***************
- *** 218,223 ****
- --- 218,224 ----
- rm -f *.o *.olb *.tmp
- rm -f core report nohup.out
- rm -f foo bar baz
- + rm -f *.target
-
- distclean: realclean
- rm -f diffc diffh
- diff -cr ../mntlib35/PatchLev.h ./PatchLev.h
- *** ../mntlib35/PatchLev.h Fri Jul 9 06:30:38 1993
- --- ./PatchLev.h Wed Sep 15 09:51:26 1993
- ***************
- *** 3,6 ****
- * directory.
- */
-
- ! #define PatchLevel "35"
- --- 3,6 ----
- * directory.
- */
-
- ! #define PatchLevel "36"
- diff -cr ../mntlib35/_addsubs.cpp ./_addsubs.cpp
- *** ../mntlib35/_addsubs.cpp Sun Jun 6 05:13:22 1993
- --- ./_addsubs.cpp Tue Sep 21 13:53:32 1993
- ***************
- *** 83,89 ****
- bclr d3,d1 | kill sign bit u.exp
- bclr d3,d0 | kill sign bit u.exp
- btst d3,d2 | same sign for u and v?
- ! bne 0f
- cmpl d0,d1 | different signs - maybe x - x ?
- seq d2 | set 'cancellation' flag
- 0:
- --- 83,89 ----
- bclr d3,d1 | kill sign bit u.exp
- bclr d3,d0 | kill sign bit u.exp
- btst d3,d2 | same sign for u and v?
- ! beq 0f
- cmpl d0,d1 | different signs - maybe x - x ?
- seq d2 | set 'cancellation' flag
- 0:
- diff -cr ../mntlib35/chmod.c ./chmod.c
- *** ../mntlib35/chmod.c Sat Jun 26 07:05:06 1993
- --- ./chmod.c Tue Sep 21 09:42:20 1993
- ***************
- *** 19,25 ****
- {
- int dosattrib = 0, r;
- char path[PATH_MAX];
- - struct stat stb;
-
- (void)_unx2dos(_path, path);
-
- --- 19,24 ----
- ***************
- *** 33,42 ****
- }
-
- /* The following lines ensure that the archive bit isn't cleared */
- ! r = Fattrib(path, 0, dosattrib);
- ! if (r > 0 && (r & FA_CHANGED))
- dosattrib |= FA_CHANGED;
-
- #if 0
- if (!(mode & S_IREAD))
- dosattrib |= FA_HIDDEN;
- --- 32,48 ----
- }
-
- /* The following lines ensure that the archive bit isn't cleared */
- ! r = Fattrib(path, 0, 0);
- ! if (r < 0)
- ! {
- ! errno = -r;
- ! return -1;
- ! }
- ! if (r & FA_CHANGED)
- dosattrib |= FA_CHANGED;
-
- + if (r & FA_DIR)
- + dosattrib |= FA_DIR;
- #if 0
- if (!(mode & S_IREAD))
- dosattrib |= FA_HIDDEN;
- ***************
- *** 46,55 ****
- r = Fattrib(path, 1, dosattrib);
- if (r < 0) {
- /* GEMDOS doesn't allow chmod on a directory, so pretend it worked */
- ! if (!stat(_path, &stb)) {
- ! if ( (stb.st_mode & S_IFMT) == S_IFDIR )
- ! return 0;
- ! }
- errno = -r;
- return -1;
- }
- --- 52,59 ----
- r = Fattrib(path, 1, dosattrib);
- if (r < 0) {
- /* GEMDOS doesn't allow chmod on a directory, so pretend it worked */
- ! if (dosattrib & FA_DIR)
- ! return 0;
- errno = -r;
- return -1;
- }
- Only in .: diffc
- diff -cr ../mntlib35/fprintf.c ./fprintf.c
- *** ../mntlib35/fprintf.c Sat Sep 5 20:48:38 1992
- --- ./fprintf.c Thu Sep 16 02:35:34 1993
- ***************
- *** 19,53 ****
- va_end(args);
- return r;
- }
- -
- - int
- - vfprintf(fp, fmt, args)
- - FILE *fp;
- - const char *fmt;
- - va_list args;
- - {
- - return(_doprnt(fp, fmt, args));
- - }
- -
- - #if __STDC__
- - int printf(const char *fmt, ...)
- - #else
- - int printf(fmt) const char *fmt;
- - #endif
- - {
- - va_list args;
- - int r;
- -
- - va_start(args, fmt);
- - r = _doprnt(stdout, fmt, args);
- - va_end(args);
- - return r;
- - }
- -
- - int
- - vprintf(fmt, args)
- - const char *fmt;
- - va_list args;
- - {
- - return(_doprnt(stdout, fmt, args));
- - }
- --- 19,21 ----
- diff -cr ../mntlib35/getcwd.c ./getcwd.c
- *** ../mntlib35/getcwd.c Sun Jun 20 08:24:30 1993
- --- ./getcwd.c Tue Sep 21 18:42:18 1993
- ***************
- *** 3,8 ****
- --- 3,9 ----
- #include <stdlib.h> /* both of these added for malloc() */
- #include <limits.h>
- #include <errno.h>
- + #include <string.h>
- #include <osbind.h>
- #include <mintbind.h>
- #include <unistd.h>
- ***************
- *** 66,70 ****
- char *getwd(buf)
- char *buf;
- {
- ! return getcwd(buf, PATH_MAX);
- }
- --- 67,75 ----
- char *getwd(buf)
- char *buf;
- {
- ! char *ret = getcwd(buf, PATH_MAX);
- ! if (ret)
- ! return ret;
- ! strcpy (buf, strerror (errno));
- ! return NULL;
- }
- diff -cr ../mntlib35/gnulib2.c ./gnulib2.c
- *** ../mntlib35/gnulib2.c Sat Dec 12 14:25:36 1992
- --- ./gnulib2.c Thu Sep 16 18:00:24 1993
- ***************
- *** 88,94 ****
- /* Define this if most significant word of a multiword number is numbered. */
- /* For 68000 we can decide arbitrarily
- since there are no machine instructions for them. */
- ! /* #define WORDS_BIG_ENDIAN */
-
- /* number of bits in an addressible storage unit */
- #define BITS_PER_UNIT 8
- --- 88,94 ----
- /* Define this if most significant word of a multiword number is numbered. */
- /* For 68000 we can decide arbitrarily
- since there are no machine instructions for them. */
- ! #define WORDS_BIG_ENDIAN
-
- /* number of bits in an addressible storage unit */
- #define BITS_PER_UNIT 8
- diff -cr ../mntlib35/isatty.c ./isatty.c
- *** ../mntlib35/isatty.c Tue Jun 22 03:21:26 1993
- --- ./isatty.c Tue Sep 21 09:54:16 1993
- ***************
- *** 51,58 ****
- --- 51,60 ----
- _isctty(fd)
- int fd;
- {
- + #if 0
- char ctty_name[L_ctermid];
- char ftty_name[L_ctermid];
- + #endif
- struct stat st, tt;
- extern int __mint;
-
- ***************
- *** 67,74 ****
- */
- return (st.st_dev == tt.st_dev && st.st_ino == tt.st_ino);
- }
- ! #endif
- (void) ctermid(ctty_name);
- (void) strncpy(ftty_name, ttyname(fd), L_ctermid);
- return !(strncmp(ctty_name, ftty_name, L_ctermid));
- }
- --- 69,81 ----
- */
- return (st.st_dev == tt.st_dev && st.st_ino == tt.st_ino);
- }
- ! /* We know that __mint < 9 (the Fcntl's above don't have the chance
- ! to fail), use the same algorithm that ttyname() uses in this
- ! case: it returns "/dev/aux" if fd == -2 */
- ! return fd != -2;
- ! #else
- (void) ctermid(ctty_name);
- (void) strncpy(ftty_name, ttyname(fd), L_ctermid);
- return !(strncmp(ctty_name, ftty_name, L_ctermid));
- + #endif
- }
- diff -cr ../mntlib35/lattice/mincl.lcc ./lattice/mincl.lcc
- *** ../mntlib35/lattice/mincl.lcc Mon Feb 22 09:44:02 1993
- --- ./lattice/mincl.lcc Wed Sep 22 15:00:40 1993
- ***************
- *** 21,27 ****
- heapbase.o ident.o il.o ic.o iw.o ig.o ip.o inistack.o \
- ioctl.o isatty.o kill.o killpg.o link.o localtim.o lockf.o lseek.o ltoa.o \
- main.o malloc.o memccpy.o memchr.o memcmp.o memcpy.o memset.o mkdir.o \
- ! mknod.o mktemp.o nice.o open.o pause.o perror.o pipe.o popen.o \
- psignal.o putenv.o qsort.o raise.o rand.o random.o read.o realloc.o \
- regexp.o regsup.o \
- rename.o rmdir.o sbrk.o scandir.o scanf.o select.o setbuf.o setlocal.o \
- --- 21,27 ----
- heapbase.o ident.o il.o ic.o iw.o ig.o ip.o inistack.o \
- ioctl.o isatty.o kill.o killpg.o link.o localtim.o lockf.o lseek.o ltoa.o \
- main.o malloc.o memccpy.o memchr.o memcmp.o memcpy.o memset.o mkdir.o \
- ! mknod.o mktemp.o nice.o open.o pause.o perror.o pipe.o popen.o printf.o \
- psignal.o putenv.o qsort.o raise.o rand.o random.o read.o realloc.o \
- regexp.o regsup.o \
- rename.o rmdir.o sbrk.o scandir.o scanf.o select.o setbuf.o setlocal.o \
- ***************
- *** 31,40 ****
- strerror.o strftime.o strlen.o stricmp.o strlwr.o strncat.o strncmp.o \
- strncpy.o strnicmp.o strpbrk.o strrchr.o strrev.o strspn.o strstr.o strtok.o \
- strtol.o strtoul.o strupr.o symlink.o sysconf.o system.o sysvar.o textio.o thread.o \
- ! time.o timeoday.o times.o tmpfile.o tmpnam.o ttyname.o uname.o \
- unlink.o unx2dos.o utime.o utmp.o wait.o wait3.o waitpid.o write.o wtmp.o \
- _divmods.o _mulsi3.o _udivmod.o _umulsi3.o bcopy.o linea.o osbind.o \
- ! setjmp.o vfork.o
-
- all: $(ALL)
-
- --- 31,40 ----
- strerror.o strftime.o strlen.o stricmp.o strlwr.o strncat.o strncmp.o \
- strncpy.o strnicmp.o strpbrk.o strrchr.o strrev.o strspn.o strstr.o strtok.o \
- strtol.o strtoul.o strupr.o symlink.o sysconf.o system.o sysvar.o textio.o thread.o \
- ! time.o timeoday.o times.o tmpfile.o tmpnam.o truncate.o ttyname.o uname.o \
- unlink.o unx2dos.o utime.o utmp.o wait.o wait3.o waitpid.o write.o wtmp.o \
- _divmods.o _mulsi3.o _udivmod.o _umulsi3.o bcopy.o linea.o osbind.o \
- ! setjmp.o vfork.o vfprintf.o vprintf.o wcmb.o
-
- all: $(ALL)
-
- Only in ../mntlib35: lblong.target
- diff -cr ../mntlib35/main.c ./main.c
- *** ../mntlib35/main.c Sun Sep 12 20:16:28 1993
- --- ./main.c Tue Sep 21 09:56:28 1993
- ***************
- *** 204,210 ****
- cnt++;
- tmp++;
- }
- ! _envp[i] = (char *) malloc(cnt * MAXPATHLEN);
- strncpy(_envp[i], s, len);
- _path_dos2unx(s + len, _envp[i] + len);
- _envp[i] = (char *) realloc(_envp[i],
- --- 204,210 ----
- cnt++;
- tmp++;
- }
- ! _envp[i] = (char *) malloc(tmp - s + cnt * 2);
- strncpy(_envp[i], s, len);
- _path_dos2unx(s + len, _envp[i] + len);
- _envp[i] = (char *) realloc(_envp[i],
- ***************
- *** 223,229 ****
- if (s[0] == 'P' && s[1] == 'A' && s[2] == 'T' &&
- s[3] == 'H' && s[4] == '=')
- {
- ! _envp[i] = (char *) malloc(5 + MAXPATHLEN);
- strncpy(_envp[i], s, 5);
- _path_dos2unx(s + 5, _envp[i] + 5);
- _envp[i] = (char *) realloc(_envp[i],
- --- 223,238 ----
- if (s[0] == 'P' && s[1] == 'A' && s[2] == 'T' &&
- s[3] == 'H' && s[4] == '=')
- {
- ! tmp = s + 5; /* tmp now after '=' */
- ! cnt = 1;
- ! while (*tmp)
- ! {
- ! /* count words */
- ! if (*tmp == ';' || *tmp == ',')
- ! cnt++;
- ! tmp++;
- ! }
- ! _envp[i] = (char *) malloc(tmp - s + cnt * 2);
- strncpy(_envp[i], s, 5);
- _path_dos2unx(s + 5, _envp[i] + 5);
- _envp[i] = (char *) realloc(_envp[i],
- diff -cr ../mntlib35/mincl ./mincl
- *** ../mntlib35/mincl Sun Jul 18 08:48:18 1993
- --- ./mincl Tue Sep 21 20:38:20 1993
- ***************
- *** 27,33 ****
- calloc.o clock.o ctime.o ctype.o difftime.o \
- fopen.o fclose.o fdopen.o fflush.o fgetc.o fgets.o \
- fputc.o fputs.o fread.o fwrite.o fseek.o fsetpos.o \
- ! eprintf.o fprintf.o sprintf.o \
- fscanf.o scanf.o sscanf.o \
- getenv.o gets.o getw.o localtim.o \
- malloc.o qsort.o raise.o rand.o realloc.o \
- --- 27,33 ----
- calloc.o clock.o ctime.o ctype.o difftime.o \
- fopen.o fclose.o fdopen.o fflush.o fgetc.o fgets.o \
- fputc.o fputs.o fread.o fwrite.o fseek.o fsetpos.o \
- ! fprintf.o vfprintf.o printf.o vprintf.o eprintf.o sprintf.o \
- fscanf.o scanf.o sscanf.o \
- getenv.o gets.o getw.o localtim.o \
- malloc.o qsort.o raise.o rand.o realloc.o \
- ***************
- *** 35,52 ****
- setlocal.o strftime.o strtol.o system.o \
- tmpnam.o tmpfile.o \
- ltoa.o main.o doprnt.o div.o \
- ! strtoul.o fungetc.o filbuf.o getbuf.o toxxx.o
-
- #
- # other miscellaneous stuff
- PORT = a64l.o alphasor.o abs.o ctermid.o cuserid.o \
- ! ffs.o findfile.o fopenp.o frwbin.o \
- ! ftw.o getpw.o gethostn.o \
- ! getlogin.o getopt.o getpages.o getpass.o grp.o ident.o mktemp.o \
- ! regexp.o regsup.o scandir.o strlwr.o strupr.o strrev.o sync.o \
- ! textio.o random.o \
- ! obstack.o utmp.o wtmp.o \
- ! il.o ic.o iw.o ig.o ip.o
-
- #
- # the string library
- --- 35,53 ----
- setlocal.o strftime.o strtol.o system.o \
- tmpnam.o tmpfile.o \
- ltoa.o main.o doprnt.o div.o \
- ! strtoul.o fungetc.o filbuf.o getbuf.o toxxx.o wcmb.o
-
- #
- # other miscellaneous stuff
- PORT = a64l.o alphasor.o abs.o ctermid.o cuserid.o \
- ! ffs.o findfile.o fopenp.o frwbin.o ftw.o \
- ! gethostn.o getlogin.o getopt.o getpages.o getpass.o getpw.o grp.o \
- ! ic.o ig.o il.o ip.o iw.o \
- ! ident.o mktemp.o nlist.o obstack.o\
- ! random.o regexp.o regsup.o \
- ! scandir.o strlwr.o strupr.o strrev.o sync.o \
- ! textio.o truncate.o \
- ! utmp.o wtmp.o
-
- #
- # the string library
- Only in .: nlist.c
- diff -cr ../mntlib35/open.c ./open.c
- *** ../mntlib35/open.c Thu Jul 15 08:12:26 1993
- --- ./open.c Tue Sep 21 13:45:42 1993
- ***************
- *** 94,110 ****
- errno = EEXIST;
- return -1;
- }
- ! if(iomode & O_TRUNC)
- rv = (int)Fcreate(filename, 0x00);
- ! else
- ! rv = (int)Fopen(filename,iomode & modemask);
- }
- else /* file doesn't exist */
- {
- if(iomode & O_CREAT) {
- rv = (int)Fcreate(filename, 0x00);
- ! if (rv >= 0 && __mint >= 9)
- ! (void)Fchmod(filename, pmode);
- }
- else
- rv = -ENOENT;
- --- 94,121 ----
- errno = EEXIST;
- return -1;
- }
- ! if(iomode & O_TRUNC) {
- rv = (int)Fcreate(filename, 0x00);
- ! if (rv >= 0) {
- ! (void)Fclose(rv);
- ! }
- ! else {
- ! errno = -rv;
- ! return -1;
- ! }
- ! }
- ! rv = (int)Fopen(filename,iomode & modemask);
- }
- else /* file doesn't exist */
- {
- if(iomode & O_CREAT) {
- rv = (int)Fcreate(filename, 0x00);
- ! if (rv >= 0) {
- ! (void)Fclose(rv);
- ! rv = (int)Fopen(filename,iomode & modemask);
- ! if (rv >= 0 && __mint >= 9)
- ! (void)Fchmod(filename, pmode);
- ! }
- }
- else
- rv = -ENOENT;
- Only in .: printf.c
- diff -cr ../mntlib35/purec/mintlib.prj ./purec/mintlib.prj
- *** ../mntlib35/purec/mintlib.prj Fri Jun 11 05:11:00 1993
- --- ./purec/mintlib.prj Wed Sep 22 15:04:44 1993
- ***************
- *** 117,122 ****
- --- 117,123 ----
- ..\pipe.c
- ..\pgrp.c
- ..\popen.c
- + ..\printf.c
- ..\psignal.c
- ..\putenv.c
- ..\qsort.c [-S -T]
- ***************
- *** 188,193 ****
- --- 189,195 ----
- ..\tmpfile.c
- ..\tmpnam.c
- ..\toxxx.c
- + ..\truncate.c
- ..\ttyname.c
- ..\uname.c
- ..\unlink.c
- ***************
- *** 194,202 ****
- --- 196,207 ----
- ..\unx2dos.c
- ..\utime.c
- ..\utmp.c
- + ..\vfprintf.c
- + ..\vprintf.c
- ..\wait.c
- ..\wait3.c
- ..\waitpid.c
- + ..\wcmb.c
- ..\write.c
- ..\wtmp.c
-
- diff -cr ../mntlib35/rename.c ./rename.c
- *** ../mntlib35/rename.c Sun Oct 20 02:16:02 1991
- --- ./rename.c Tue Sep 21 09:59:44 1993
- ***************
- *** 12,22 ****
- {
- char oldname[PATH_MAX], newname[PATH_MAX];
- int rval;
- !
- if (!strcmp(_oldname, _newname)) {
- rval = 0; /* no-op */
- }
- !
- if (!access(_newname, 0)) { /* new name already exists */
- if (unlink(_newname))
- return -1;
- --- 12,22 ----
- {
- char oldname[PATH_MAX], newname[PATH_MAX];
- int rval;
- ! #if 0
- if (!strcmp(_oldname, _newname)) {
- rval = 0; /* no-op */
- }
- ! #endif
- if (!access(_newname, 0)) { /* new name already exists */
- if (unlink(_newname))
- return -1;
- diff -cr ../mntlib35/sigactio.c ./sigactio.c
- *** ../mntlib35/sigactio.c Sun Jul 18 08:20:38 1993
- --- ./sigactio.c Tue Sep 21 10:02:28 1993
- ***************
- *** 9,16 ****
- extern __Sigfunc _sig_handler[__NSIG];
-
- #ifdef __MSHORT__
- ! typedef void __CDECL (*__KerSigfunc) __PROTO((long));
- ! __EXTERN void __CDECL _trampoline __PROTO((long sig));
- #else
- typedef void __CDECL (*__KerSigfunc) __PROTO((int));
- #endif
- --- 9,16 ----
- extern __Sigfunc _sig_handler[__NSIG];
-
- #ifdef __MSHORT__
- ! typedef void __CDECL (*__KerSigfunc) __PROTO((long, long));
- ! __EXTERN void __CDECL _trampoline __PROTO((long sig, long code));
- #else
- typedef void __CDECL (*__KerSigfunc) __PROTO((int));
- #endif
- diff -cr ../mntlib35/signal.c ./signal.c
- *** ../mntlib35/signal.c Sat Sep 5 22:00:40 1992
- --- ./signal.c Tue Sep 21 10:02:32 1993
- ***************
- *** 22,41 ****
- * we previously established
- */
-
- ! void __CDECL _trampoline __PROTO((long));
-
- /* the argument is on the stack */
- ! void __CDECL _trampoline(sig)
- ! long sig;
- {
- ! __Sigfunc func;
-
- ! func = _sig_handler[sig];
-
- /* note: func should never be SIG_IGN or SIG_DFL; if it is, something
- * really bad happened and we want to crash anyway!
- */
- ! (*func)((short)sig);
- }
- #endif
-
- --- 22,41 ----
- * we previously established
- */
-
- ! void __CDECL _trampoline __PROTO((long, long));
-
- /* the argument is on the stack */
- ! void __CDECL _trampoline(sig, code)
- ! long sig, code;
- {
- ! void (*func) __PROTO ((int, int));
-
- ! func = (void (*) __PROTO ((int, int))) _sig_handler[sig];
-
- /* note: func should never be SIG_IGN or SIG_DFL; if it is, something
- * really bad happened and we want to crash anyway!
- */
- ! (*func)((int)sig, (int) code);
- }
- #endif
-
- diff -cr ../mntlib35/sozobon/makefile ./sozobon/makefile
- *** ../mntlib35/sozobon/makefile Mon Sep 13 06:18:44 1993
- --- ./sozobon/makefile Wed Sep 22 14:54:38 1993
- ***************
- *** 47,60 ****
-
- # These are in alphabetical order to make it easy to find one.
- OBJECTS = \
- ! abort.o abs.o access.o alarm.o alloca.o alphasor.o \
- atexit.o atol.o \
- bcmp.o bcopy.o binmode.o bsearch.o bzero.o \
- calloc.o chdir.o chmod.o clock.o close.o console.o crtinit.o \
- ! ctermid.o ctime.o ctype.o cuserid.o\
- defmode.o difftime.o dirent.o doprnt.o dup.o \
- eprintf.o exec.o execp.o\
- ! fclose.o fcntl.o fdopen.o fflush.o ffs.o fgetc.o fgets.o filbuf.o \
- findfile.o fopen.o fopenp.o fork.o fprintf.o fputc.o fputs.o \
- fread.o frwbin.o fscanf.o fseek.o fsetpos.o ftw.o fungetc.o \
- fwrite.o \
- --- 47,60 ----
-
- # These are in alphabetical order to make it easy to find one.
- OBJECTS = \
- ! abort.o abs.o access.o alarm.o alloca.o alphasor.o \
- atexit.o atol.o \
- bcmp.o bcopy.o binmode.o bsearch.o bzero.o \
- calloc.o chdir.o chmod.o clock.o close.o console.o crtinit.o \
- ! ctermid.o ctime.o ctype.o cuserid.o \
- defmode.o difftime.o dirent.o doprnt.o dup.o \
- eprintf.o exec.o execp.o\
- ! fclose.o fcntl.o fdopen.o fflush.o ffs.o fgetc.o fgets.o filbuf.o \
- findfile.o fopen.o fopenp.o fork.o fprintf.o fputc.o fputs.o \
- fread.o frwbin.o fscanf.o fseek.o fsetpos.o ftw.o fungetc.o \
- fwrite.o \
- ***************
- *** 70,76 ****
- mktemp.o \
- nice.o \
- obstack.o open.o osbind.o \
- ! pause.o perror.o pgrp.o pipe.o popen.o psignal.o putenv.o \
- qsort.o \
- raise.o rand.o random.o read.o realloc.o regexp.o regsup.o \
- rename.o rmdir.o \
- --- 70,76 ----
- mktemp.o \
- nice.o \
- obstack.o open.o osbind.o \
- ! pause.o perror.o pgrp.o pipe.o popen.o printf.o psignal.o putenv.o \
- qsort.o \
- raise.o rand.o random.o read.o realloc.o regexp.o regsup.o \
- rename.o rmdir.o \
- ***************
- *** 84,93 ****
- strspn.o strstr.o strtok.o strtol.o strtoul.o strupr.o symlink.o \
- sysconf.o system.o sysvar.o \
- textio.o thread.o time.o timeoday.o times.o tmpfile.o tmpnam.o \
- ! toxxx.o ttyname.o \
- uname.o unlink.o unx2dos.o utime.o utmp.o \
- ! vfork.o \
- ! wait.o wait3.o waitpid.o write.o wtmp.o
-
- # Rule to handle .cpp files
- .SUFFIXES: .cpp
- --- 84,93 ----
- strspn.o strstr.o strtok.o strtol.o strtoul.o strupr.o symlink.o \
- sysconf.o system.o sysvar.o \
- textio.o thread.o time.o timeoday.o times.o tmpfile.o tmpnam.o \
- ! toxxx.o truncate.o ttyname.o \
- uname.o unlink.o unx2dos.o utime.o utmp.o \
- ! vfork.o vfprintf.o vprintf.o \
- ! wait.o wait3.o waitpid.o wcmb.o write.o wtmp.o
-
- # Rule to handle .cpp files
- .SUFFIXES: .cpp
- diff -cr ../mntlib35/spawn.c ./spawn.c
- *** ../mntlib35/spawn.c Mon Sep 13 22:59:12 1993
- --- ./spawn.c Tue Sep 21 09:50:36 1993
- ***************
- *** 29,34 ****
- --- 29,39 ----
- using /bin/sh
- Files which have i.e '#!/usr/bin/awk -f' as their first character
- are interpreted with "/usr/bin/awk -f <file>"
- +
- + 17 Sep 1993 schwab
- + cleaned up emulation code for script execution.
- + File is only interpretable if first two bytes are "#!".
- + Don't modify errno if there is no error.
- */
-
- #include <stdarg.h>
- ***************
- *** 54,74 ****
-
- #ifdef HASH_BANG
-
- ! static char *extensions[] = { "ttp", "prg", "tos", NULL };
-
- ! static int interpret_script __PROTO((int mode, char *path,
- ! char **argv, char **envp));
-
- static int
- interpret_script(mode, path, argv, envp)
- int mode;
- ! char *path;
- ! char **argv;
- ! char **envp;
- {
- - char shellpath[MAXPATHLEN];
- char tmppath[MAXPATHLEN];
- - char args[TOS_ARGS + 1];
- char *shell;
- char *shellargs;
- char **shellargv;
- --- 59,77 ----
-
- #ifdef HASH_BANG
-
- ! static char *const extensions[] = { "ttp", "prg", "tos", NULL };
-
- ! static int interpret_script __PROTO((int mode, const char *path,
- ! char *const *argv, char *const *envp));
-
- static int
- interpret_script(mode, path, argv, envp)
- int mode;
- ! const char *path;
- ! char *const *argv;
- ! char *const *envp;
- {
- char tmppath[MAXPATHLEN];
- char *shell;
- char *shellargs;
- char **shellargv;
- ***************
- *** 76,199 ****
- int fd;
- int argcount;
- int i, rv;
- ! char buf;
- !
- /* path is already converted to dos */
- if ((fd = (int)Fopen(path, 0)) < 0)
- ! return -fd;
- !
- ! if (Fread(fd, 1L, &buf) != 1L) {
- ! Fclose(fd);
- ! return -1;
- ! }
- !
- ! if (buf == '#') {
- ! if (Fread(fd, 1L, &buf) != 1L) {
- ! Fclose(fd);
- ! return -1;
- ! }
- !
- ! if (buf == '!') {
- !
- ! /* skip blanks */
- ! do {
- ! if (Fread(fd, 1L, &buf) != 1L) {
- ! Fclose(fd);
- ! return -1;
- ! }
- ! } while (buf == ' ' || buf == '\t');
- !
- ! /* read filename */
- ! for (i = 0; i < MAXPATHLEN; i++) {
- ! if (buf == ' ' || buf == '\t' ||
- ! buf == '\r' || buf == '\n')
- ! break;
- ! shellpath[i] = buf;
- !
- ! if (Fread(fd, 1L, &buf) != 1L) {
- ! Fclose(fd);
- ! return -1;
- ! }
- ! }
- ! shellpath[i] = '\0';
- ! shell = shellpath;
- !
- ! /*
- ! * read arguments if any
- ! * maximum is TOS_ARGS (only restricted for my comfort :-)
- ! */
- ! nargcount = 0;
- ! i = 0;
- ! while(i < TOS_ARGS && buf != '\r' && buf != '\n') {
- ! /* skip blanks */
- ! do {
- ! if (Fread(fd, 1L, &buf) != 1L) {
- ! Fclose(fd);
- ! return -1;
- ! }
- ! } while (buf == ' ' || buf == '\t');
- !
- ! if (buf == '\r' || buf == '\n')
- ! break;
- !
- ! while ( buf != ' ' && buf != '\t' &&
- ! buf != '\r' && buf != '\n' && i < TOS_ARGS) {
- ! args[i++] = buf;
- ! if (Fread(fd, 1L, &buf) != 1L) {
- ! Fclose(fd);
- ! return -1;
- ! }
- ! }
- ! args[i++] = '\0';
- ! nargcount++;
- ! }
- ! args[i] = '\0';
- ! shellargs = args;
- ! }
- ! else {
- ! shell = "/bin/sh";
- ! nargcount = 0;
- ! args[0] = '\0';
- ! shellargs = args;
- ! }
- !
- ! Fclose(fd);
-
- ! if (*shell) {
- !
- ! shell = buffindfile(shell, getenv("PATH"), extensions, tmppath);
- ! if (!shell) {
- ! errno = ENOENT;
- ! return -1; /* file not found */
- ! }
- !
- ! /* count old args */
- ! for (i = 0; argv[i] != 0; i++);
- ! argcount = i;
- !
- ! shellargv = (char **)Malloc((argcount + nargcount + 2) * sizeof(char *));
- ! if (!shellargv) {
- ! errno = ENOMEM;
- ! return -1;
- ! }
- !
- ! i = 0;
- ! shellargv[i++] = shell;
- ! while(*shellargs != '\0') {
- ! shellargv[i++] = shellargs;
- ! while (*shellargs++ != '\0');
- ! }
- !
- ! while (*argv != NULL)
- ! shellargv[i++] = *argv++;
- ! shellargv[i] = NULL;
- !
- ! rv = _spawnve(mode, shell, shellargv, envp);
- ! (void)Mfree(shellargv);
- ! return rv;
- ! }
- ! }
-
- return -1;
- }
-
- --- 79,180 ----
- int fd;
- int argcount;
- int i, rv;
- ! char buf[1024], *bufp, *argp;
- ! long r;
- !
- /* path is already converted to dos */
- if ((fd = (int)Fopen(path, 0)) < 0)
- ! {
- ! errno = -fd;
- ! return -1;
- ! }
- !
- ! r = Fread (fd, (long) sizeof (buf) - 1L, buf);
- ! Fclose (fd);
- ! if (r < 0)
- ! {
- ! errno = -(int) r;
- ! return -1;
- ! }
- ! buf[r] = 0;
- !
- ! if (buf[0] == '#' && buf[1] == '!')
- ! {
- ! /* skip blanks */
- ! bufp = buf + 2;
- ! while (*bufp == '\t' || *bufp == ' ')
- ! bufp++;
- !
- ! /* read filename */
- ! shell = bufp;
- ! while (*bufp && *bufp != ' ' && *bufp != '\t'
- ! && *bufp != '\r' && *bufp != '\n')
- ! bufp++;
- !
- ! if (*bufp && *bufp != '\r' && *bufp != '\n')
- ! *bufp++ = 0;
- ! /* else the null will be added below */
- !
- ! /*
- ! * read arguments if any
- ! */
- ! argp = shellargs = bufp;
- ! nargcount = 0;
- ! i = 0;
- ! while (*bufp && *bufp != '\r' && *bufp != '\n')
- ! {
- ! /* skip blanks */
- ! while (*bufp == ' ' || *bufp == '\t')
- ! bufp++;
- !
- ! if (*bufp == '\r' || *bufp == '\n')
- ! break;
- !
- ! while (*bufp && *bufp != ' ' && *bufp != '\t'
- ! && *bufp != '\r' && *bufp != '\n')
- ! *argp++ = *bufp++;
- ! *argp++ = '\0';
- ! nargcount++;
- ! }
- ! *argp = '\0';
-
- ! if (*shell)
- ! {
- ! shell = buffindfile (shell, getenv("PATH"), extensions, tmppath);
- ! if (!shell)
- ! {
- ! errno = ENOENT;
- ! return -1; /* file not found */
- ! }
- !
- ! /* count old args */
- ! for (i = 0; argv[i] != 0; i++);
- ! argcount = i;
- !
- ! shellargv = (char **)Malloc((argcount + nargcount + 2) * sizeof(char *));
- ! if (!shellargv) {
- ! errno = ENOMEM;
- ! return -1;
- ! }
- !
- ! i = 0;
- ! shellargv[i++] = shell;
- ! while(*shellargs != '\0') {
- ! shellargv[i++] = shellargs;
- ! while (*shellargs++ != '\0');
- ! }
- !
- ! while (*argv != NULL)
- ! shellargv[i++] = *argv++;
- ! shellargv[i] = NULL;
- !
- ! rv = _spawnve(mode, shell, shellargv, envp);
- ! (void)Mfree(shellargv);
- ! return rv;
- ! }
- ! }
-
- + errno = ENOEXEC;
- return -1;
- }
-
- ***************
- *** 219,226 ****
- size_t len, cnt;
- int i, done;
- #ifdef HASH_BANG
- ! char **_envp;
- ! char **_argv;
- #endif
-
- if (mode != P_WAIT && mode != P_OVERLAY && mode != P_NOWAIT) {
- --- 200,207 ----
- size_t len, cnt;
- int i, done;
- #ifdef HASH_BANG
- ! char *const *_envp;
- ! char *const *_argv;
- #endif
-
- if (mode != P_WAIT && mode != P_OVERLAY && mode != P_NOWAIT) {
- ***************
- *** 490,499 ****
-
- if (rval < 0)
- {
- - errno = (int) -rval;
- - rval = -1;
- #ifdef HASH_BANG
- ! if (errno == ENOEXEC) {
- char *umode;
-
- /* try to find UNIXMODE in environment */
- --- 471,478 ----
-
- if (rval < 0)
- {
- #ifdef HASH_BANG
- ! if (rval == -ENOEXEC) {
- char *umode;
-
- /* try to find UNIXMODE in environment */
- ***************
- *** 504,509 ****
- --- 483,490 ----
- }
- }
- #endif
- + errno = (int) -rval;
- + rval = -1;
- }
- else if (mode == P_OVERLAY)
- /* note that we get here only if MiNT is not active! */
- Only in .: truncate.c
- diff -cr ../mntlib35/ttyname.c ./ttyname.c
- *** ../mntlib35/ttyname.c Sat Jun 19 10:39:30 1993
- --- ./ttyname.c Tue Sep 21 10:05:46 1993
- ***************
- *** 8,16 ****
- #include <stdio.h>
- #include <types.h>
- #include <stat.h>
- - #include <dirent.h>
- #include <string.h>
- #include <unistd.h>
-
- extern int __mint;
-
- --- 8,20 ----
- #include <stdio.h>
- #include <types.h>
- #include <stat.h>
- #include <string.h>
- #include <unistd.h>
- + #include <mintbind.h>
- + #include <limits.h>
- + #include <errno.h>
- + #include <ioctl.h>
- + #include "lib.h"
-
- extern int __mint;
-
- ***************
- *** 20,26 ****
-
- /* Find the file in directory "dir" that matches "sbuf". Returns 1
- * on success, 0 on failure. Note that "dir" is a prefix, i.e. it
- ! * should end with "/".
- */
-
- static int
- --- 24,30 ----
-
- /* Find the file in directory "dir" that matches "sbuf". Returns 1
- * on success, 0 on failure. Note that "dir" is a prefix, i.e. it
- ! * should end with "\\".
- */
-
- static int
- ***************
- *** 29,57 ****
- struct stat *sb;
- char *name;
- {
- ! char *where = name;
- ! DIR *drv;
- ! struct dirent *next;
- struct stat testsb;
-
- ! drv = opendir(dir);
- ! if (!drv) return 0;
-
- while (*dir) {
- *where++ = *dir++;
- }
-
- ! while ((next = readdir(drv)) != NULL) {
- ! strcpy(where, next->d_name);
- ! if (stat(name, &testsb))
- continue;
- if (testsb.st_dev == sb->st_dev &&
- testsb.st_ino == sb->st_ino) {
- ! closedir(drv);
- return 1;
- }
- }
- ! closedir(drv);
- return 0;
- }
-
- --- 33,66 ----
- struct stat *sb;
- char *name;
- {
- ! char _name[PATH_MAX];
- ! char *where = _name;
- ! long drv;
- struct stat testsb;
- + struct dbuf {
- + long ino;
- + char name[NAME_MAX + 1];
- + } dbuf;
-
- ! drv = Dopendir (dir, 0);
- ! if ((drv & 0xff000000L) == 0xff000000L) return 0;
-
- while (*dir) {
- *where++ = *dir++;
- }
-
- ! while (Dreaddir((int) sizeof (dbuf), drv, &dbuf) == 0) {
- ! strcpy(where, dbuf.name);
- ! if (Fxattr(0, _name, &testsb))
- continue;
- if (testsb.st_dev == sb->st_dev &&
- testsb.st_ino == sb->st_ino) {
- ! Dclosedir(drv);
- ! _dos2unx (_name, name);
- return 1;
- }
- }
- ! Dclosedir(drv);
- return 0;
- }
-
- ***************
- *** 74,88 ****
- return tname;
- }
-
- ! if (fstat(fd, &sb))
- return (char *)0;
-
- /* try the devices first */
- ! if (find_ino("/dev/", &sb, tname))
- return tname;
-
- /* hmmm, maybe we're a pseudo-tty */
- ! if (find_ino("u:/pipe/", &sb, tname))
- return tname;
-
- /* I give up */
- --- 83,97 ----
- return tname;
- }
-
- ! if (Fcntl(fd, &sb, FSTAT))
- return (char *)0;
-
- /* try the devices first */
- ! if (find_ino("u:\\dev\\", &sb, tname))
- return tname;
-
- /* hmmm, maybe we're a pseudo-tty */
- ! if (find_ino("u:\\pipe\\", &sb, tname))
- return tname;
-
- /* I give up */
- diff -cr ../mntlib35/utime.c ./utime.c
- *** ../mntlib35/utime.c Wed Sep 8 14:57:32 1993
- --- ./utime.c Tue Sep 21 10:10:06 1993
- ***************
- *** 55,61 ****
- const struct utimbuf *tset;
- {
- int fh;
- ! time_t actime, modtime;
- unsigned long dtime; /* dos time equivalent */
-
- char filename[PATH_MAX];
- --- 55,61 ----
- const struct utimbuf *tset;
- {
- int fh;
- ! unsigned long actime, modtime;
- unsigned long dtime; /* dos time equivalent */
-
- char filename[PATH_MAX];
- ***************
- *** 64,86 ****
-
- if (tset)
- {
- ! modtime = tset->modtime;
- ! actime = tset->actime;
- }
- else
- {
- ! time(&actime);
- modtime = actime;
- }
-
- (void)_unx2dos(_filename, filename);
-
- ! dtime = _dostime(actime);
- ! settime.actime = (unsigned short) ((dtime >> 16) & 0xFFFF);
- ! settime.acdate = (unsigned short) (dtime & 0xFFFF);
- ! dtime = _dostime(modtime);
- ! settime.modtime = (unsigned short) ((dtime >> 16) & 0xFFFF);
- ! settime.moddate = (unsigned short) (dtime & 0xFFFF);
- fh = (int) Fopen(filename, 2);
- if (fh < 0) {
- errno = -fh;
- --- 64,84 ----
-
- if (tset)
- {
- ! modtime = _dostime (tset->modtime);
- ! actime = _dostime (tset->actime);
- }
- else
- {
- ! actime = ((long) Tgettime () << 16) | (Tgetdate () & 0xFFFF);
- modtime = actime;
- }
-
- (void)_unx2dos(_filename, filename);
-
- ! settime.actime = (unsigned short) ((actime >> 16) & 0xFFFF);
- ! settime.acdate = (unsigned short) (actime & 0xFFFF);
- ! settime.modtime = (unsigned short) ((modtime >> 16) & 0xFFFF);
- ! settime.moddate = (unsigned short) (modtime & 0xFFFF);
- fh = (int) Fopen(filename, 2);
- if (fh < 0) {
- errno = -fh;
- ***************
- *** 95,101 ****
- --- 93,102 ----
- res = Fcntl(fh, (long)0, FUTIME);
- }
- if (res == -EINVAL)
- + {
- + dtime = modtime;
- (void)Fdatime((_DOSTIME *) &dtime, fh, 1);
- + }
-
- if ((fh = Fclose(fh)) != 0) {
- errno = -fh;
- ***************
- *** 109,114 ****
- --- 110,116 ----
- {
- unsigned long dtime;
- unsigned date, time;
- + long r;
-
- assert(t != 0);
- dtime = _dostime(*t);
- ***************
- *** 115,122 ****
- date = (int) (dtime & 0xffff);
- time = (int) (dtime >> 16) & 0xffff;
-
- ! if (Tsetdate(date) || Tsettime(time)) {
- ! errno = EBADARG;
- return -1;
- }
- return 0;
- --- 117,124 ----
- date = (int) (dtime & 0xffff);
- time = (int) (dtime >> 16) & 0xffff;
-
- ! if ((r = Tsetdate(date)) || (r = Tsettime(time))) {
- ! errno = r == -1 ? EBADARG : (int) -r;
- return -1;
- }
- return 0;
- Only in .: vfprintf.c
- Only in .: vprintf.c
- diff -cr ../mntlib35/waitpid.c ./waitpid.c
- *** ../mntlib35/waitpid.c Mon Sep 13 06:58:12 1993
- --- ./waitpid.c Sat Sep 18 02:47:54 1993
- ***************
- *** 22,29 ****
- long r;
- int exit_status, sig_term;
- union wait *statwait;
- int *status = _status.__wi;
- !
- statwait = (union wait *) status;
- if (__mint == 0) {
- r = __waitval;
- --- 22,33 ----
- long r;
- int exit_status, sig_term;
- union wait *statwait;
- + #ifdef __GNUC__
- int *status = _status.__wi;
- ! #else
- ! int *status = _status;
- ! #endif
- !
- statwait = (union wait *) status;
- if (__mint == 0) {
- r = __waitval;
- Only in .: wcmb.c
- *** /dev/null Wed Sep 22 15:23:54 1993
- --- nlist.c Sun Jul 18 15:00:32 1993
- ***************
- *** 0 ****
- --- 1,153 ----
- + /* nlist for mintlib/toslib.
- + * Written by S.N. Henson and released into the public domain.
- + *
- + * Currently uses just standard and GST extended symbol formats.
- + */
- +
- + #include <st-out.h>
- + #include <fcntl.h>
- + #include <unistd.h>
- + #include <errno.h>
- + #include <macros.h>
- + #include <nlist.h>
- + #include <string.h>
- +
- + #define SYM_BUFSIZE 100
- + #define SYMSIZE sizeof(struct asym)
- + #define GSYM_SIZE 23
- +
- + static int sym_fd;
- +
- + static long symcount;
- +
- + static int getsym __PROTO((struct asym *sptr));
- +
- + /* Read a symbol from a file and put it in sptr */
- + static int getsym(sptr)
- + struct asym *sptr;
- + {
- + static struct asym symbuf[SYM_BUFSIZE],*symptr;
- + static long symread;
- + if( !symread )
- + {
- + symread=min(sizeof(symbuf),symcount);
- + if(symread!=read(sym_fd,symbuf,symread))
- + {
- + close(sym_fd);
- + symread=0;
- + errno=EREAD; /* Premature EOF */
- + return -1;
- + }
- + symptr=symbuf;
- + }
- +
- + *sptr=*symptr++;
- + symread-=SYMSIZE;
- +
- + if( symread < 0 )
- + {
- + symread=0;
- + errno=EREAD;
- + return -1;
- + }
- +
- + return 0;
- + }
- +
- + int nlist(file,nl)
- + char *file;
- + struct nlist *nl;
- + {
- +
- + struct nlist *p;
- +
- + struct aexec hbuf;
- +
- + struct asym sym;
- +
- + long nl_count;
- +
- + if(!file || !nl)
- + {
- + errno=EFAULT;
- + return -1;
- + }
- +
- + if( ( sym_fd=open(file,O_RDONLY) ) == -1 ) return -1;
- +
- + /* Read in file header */
- + read(sym_fd,&hbuf,sizeof(hbuf));
- +
- + /* Executable file ? */
- + if(A_BADMAG(hbuf))
- + {
- + close(sym_fd);
- + errno=ENOEXEC;
- + return -1;
- + }
- +
- + /* Any symbols? */
- + if( !(symcount=hbuf.a_syms) )
- + {
- + errno=EDOM;
- + return -1;
- + }
- +
- + if( symcount < sizeof(struct asym) )
- + {
- + close(sym_fd);
- + errno=EREAD;
- + return -1;
- + }
- +
- + /* Seek to symbol table */
- + if( A_SYMOFF(hbuf)!=lseek(sym_fd,A_SYMOFF(hbuf),SEEK_SET) )
- + {
- + close(sym_fd);
- + errno=EREAD;
- + return -1;
- + }
- +
- + /* Count number of symbols to match */
- + for(p=nl,nl_count=0;p->n_name;p++)
- + {
- + nl_count++;
- + p->n_value=p->n_type=0;
- + }
- +
- + if(!nl_count) return 0;
- +
- + do
- + {
- + char name[GSYM_SIZE];
- +
- + /* Get one symbol from file */
- + if(getsym(&sym)) return -1;
- +
- + symcount-=SYMSIZE;
- +
- + strncpy(name,sym.a_name,8);
- +
- + /* If extended symbol, get rest of name */
- + if( (sym.a_type & A_LNAM) == A_LNAM)
- + {
- + if( (symcount <= 0) || getsym((struct asym *)(name+8)))
- + return -1;
- + symcount-=SYMSIZE;
- + name[22]=0;
- + }
- + else name[8]=0;
- +
- + /* Check for match */
- + for(p=nl;p->n_name;p++)
- + {
- + if(p->n_type || strcmp(name,p->n_name)) continue;
- + p->n_value=sym.a_value;
- + p->n_type=sym.a_type;
- + if(--nl_count==0) return 0;
- + }
- + }
- + while(symcount > 0);
- +
- + return nl_count;
- + }
- *** /dev/null Wed Sep 22 15:24:08 1993
- --- printf.c Thu Sep 16 02:35:34 1993
- ***************
- *** 0 ****
- --- 1,18 ----
- + #include <stdio.h>
- + #include <stdarg.h>
- + #include "lib.h"
- +
- + #if __STDC__
- + int printf(const char *fmt, ...)
- + #else
- + int printf(fmt) const char *fmt;
- + #endif
- + {
- + va_list args;
- + int r;
- +
- + va_start(args, fmt);
- + r = _doprnt(stdout, fmt, args);
- + va_end(args);
- + return r;
- + }
- *** /dev/null Wed Sep 22 15:24:18 1993
- --- truncate.c Tue Sep 21 20:24:34 1993
- ***************
- *** 0 ****
- --- 1,80 ----
- + /*
- +
- + Here is an implementation of truncate/ftruncate for the MiNTlib. There
- + is a special case for truncate, if the filesystem does not recognize
- + FTRUNCATE and the length is zero, Fcreate is used to truncate the
- + file. This only works for tosfs if the file isn't already open. The
- + rest is quite straight forward.
- +
- + Andreas.
- +
- + Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
- +
- + */
- +
- + #include <compiler.h>
- + #include <limits.h>
- + #include <errno.h>
- + #include <mintbind.h>
- + #include <ioctl.h>
- + #ifdef __TURBOC__
- + #include <sys\types.h>
- + #else
- + #include <sys/types.h>
- + #endif
- + #include "lib.h"
- +
- + extern int __mint;
- +
- + int
- + truncate (_filename, length)
- + const char *_filename;
- + off_t length;
- + {
- + int fh, res;
- + char filename[PATH_MAX];
- +
- + (void) _unx2dos (_filename, filename);
- + fh = Fopen (filename, 2);
- + if (fh < 0)
- + {
- + errno = -fh;
- + return -1;
- + }
- + res = -EINVAL;
- + if (__mint > 90)
- + res = Fcntl (fh, (long) &length, FTRUNCATE);
- + Fclose (fh);
- + if (res == -EINVAL && length == 0)
- + {
- + res = Fcreate (filename, 0);
- + if (res >= 0)
- + Fclose (res);
- + }
- + if (res < 0)
- + {
- + errno = -res;
- + return -1;
- + }
- + return 0;
- + }
- +
- + int
- + ftruncate (fd, length)
- + int fd;
- + off_t length;
- + {
- + int res;
- +
- + if (__mint > 90)
- + res = Fcntl (fd, (long) &length, FTRUNCATE);
- + else
- + res = -EINVAL;
- +
- + if (res < 0)
- + {
- + errno = -res;
- + return -1;
- + }
- + return 0;
- + }
- *** /dev/null Wed Sep 22 15:24:30 1993
- --- vfprintf.c Thu Sep 16 02:35:34 1993
- ***************
- *** 0 ****
- --- 1,13 ----
- + #include <stdio.h>
- + #include <stdarg.h>
- + #include "lib.h"
- +
- +
- + int
- + vfprintf(fp, fmt, args)
- + FILE *fp;
- + const char *fmt;
- + va_list args;
- + {
- + return(_doprnt(fp, fmt, args));
- + }
- *** /dev/null Wed Sep 22 15:24:54 1993
- --- vprintf.c Thu Sep 16 02:35:34 1993
- ***************
- *** 0 ****
- --- 1,10 ----
- + #include <stdio.h>
- + #include <stdarg.h>
- + #include "lib.h"
- + int
- + vprintf(fmt, args)
- + const char *fmt;
- + va_list args;
- + {
- + return(_doprnt(stdout, fmt, args));
- + }
- *** /dev/null Wed Sep 22 15:24:40 1993
- --- wcmb.c Tue Sep 21 09:04:18 1993
- ***************
- *** 0 ****
- --- 1,79 ----
- + /* This implements the wc* and mb* ANSI/ISO functions.
- + They're in the "DUMB" locale ;), and in the public domain.
- + */
- +
- + #include <stdlib.h>
- + #include <stddef.h>
- +
- + int
- + mblen(mbstr, n)
- + const char *mbstr;
- + size_t n;
- + {
- + /* Locale test: no shift states. */
- + if(mbstr == NULL) return 0;
- +
- + if(*mbstr == '\0' || n == 0) return 0;
- +
- + /* There are no multibytesequences... */
- + return 1;
- + }
- +
- + size_t
- + mbstowcs(wstr, mbstr, maxlen)
- + wchar_t *wstr;
- + const char *mbstr;
- + size_t maxlen;
- + {
- + size_t revcnt = maxlen;
- +
- + if(mbstr == NULL) mbstr = "";
- +
- + while(revcnt && (*wstr++ = *mbstr++)) revcnt--;
- +
- + return maxlen - revcnt;
- + }
- +
- + int
- + mbtowc(wstr, mbstr, n)
- + wchar_t *wstr;
- + const char *mbstr;
- + size_t n;
- + {
- + /* Locale test: no shift states. */
- + if(mbstr == NULL) return 0;
- +
- + if(*mbstr == '\0' || n == 0) return 0;
- +
- + if(wstr != NULL) *wstr = *mbstr;
- + return 1;
- + }
- +
- +
- + size_t
- + wcstombs(mbstr, wstr, maxlen)
- + char *mbstr;
- + const wchar_t *wstr;
- + size_t maxlen;
- + {
- + size_t revcnt = maxlen;
- + static const wchar_t wnull[1] = { 0 };
- +
- + if(wstr == NULL) wstr = wnull; /* Better avoid L"". */
- +
- + while(revcnt && (*mbstr++ = (char) *wstr++)) revcnt--;
- +
- + return maxlen - revcnt;
- + }
- +
- + int
- + wctomb(mbstr, wchar)
- + char *mbstr;
- + wchar_t wchar;
- + {
- + /* Nope, still no statedependencies. */
- + if(mbstr == NULL) return 0;
- +
- + *mbstr = (char) wchar;
- + return 1;
- + }
-